<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <title>{$info.title}</title>
    <link rel="stylesheet" href="__STATIC_URL__/static/mobile/css/weui.css"/>

    <link rel="stylesheet" href="__STATIC_URL__/static/mobile/mycord/css/paycards.css" />
    <link rel="stylesheet" href="__STATIC_URL__/static/mobile/css/setpaycard.css" />
<style>
    .commodityIntroBox {
        line-height: 20px;
        min-height: 20px;
        text-align: left;
        padding-left: 20px;
        padding-right: 20px;
        padding-top: 20px;
        font-size: 15px;
    }
    .commodityUnivalenceBox {
        overflow: hidden;
        text-align: left;
        height: 20px;
        line-height: 20px;
        padding-left: 20px;
        padding-right: 20px;
    }
    .colorred {
        color: #da1a19;
        font-family: "Microsoft YaHei UI";
    }
    .colorred .oldprice {
        margin-left: 5px;
        color: #aeaeae;
        font-size: 14px;
        text-decoration: line-through;
    }
    .pad10{
        padding:10px;
    }
    /*==================秒杀列表==================*/
    .dian{
        font-size: 1.2em;
        line-height: 1.2em;
        padding:0 5px;
    }
    .right{
        text-align:center;
    }
    .time-item{
        display:inline-block;
    }
    .timetitle {
        display:inline-block;
        font-size: 1.2em;
        line-height: 1.2em;
        color: #808080;
    }
    .time-item strong {
        background: #2e2e2e;
        color:#fff;
        line-height:2rem;
        font-size: 16px;
        font-family:Arial;
        padding:0 10px;

        border-radius:3px;
        box-shadow:1px 1px 3px rgba(0,0,0,0.2);
    }
    #day_show {
        float:left;
        line-height:2rem;
        color: #616060;
        font-size: 16px;
        margin:0 10px;
        font-family:Arial,Helvetica,sans-serif;
    }
    .item-title .unit {
        background:none;
        line-height:49px;
        font-size:24px;
        padding:0 10px;
        float:left;
    }
    .footer {
        position: fixed;
        bottom: 0;
        height: 56px;
        width: 100%;
        border-top: 1px solid #eee;
        background: #fff;
        z-index: 1;
    }
    .footer .weui-btn_default {
        display: block;
        width: 80%;
        margin: 10px auto;
        border-radius: 10px;
        font-size: 1.5em;
        text-align: center;
        color: #ff5000;
        line-height: 3rem;

    }
    .footer .weui-btn_primary  {
        display: block;
        width: 80%;
        margin: 10px auto;
        border-radius: 10px;
        font-size: 1.5em;
        text-align: center;
        color: #fff;
        background:#1AAD19;
        line-height: 3rem;

    }
    .weui-media-box__info {

        line-height: 1.2em;

    }
    .btn {
         margin-top: 0;
    }
    .weui-panel__hd:after {

         border-bottom: none;

    }
    .info{
        padding:15px;
    }
</style>
</head>
<body>
<div class="content">
    <div class="page__bd">
        <div class="commodityImgBox">
            <img src="{$info.img}" alt="商品图片" class="commodityImg">
        </div>
        <div class="mtop10 commodityIntroBox">
            <span class="color1 c-inlineblock c-aligh-left goodsjianjie">{$info.goodsjianjie}</span>
        </div>
        <div class="mtop5 colorred commodityUnivalenceBox">

            <span class="commodityUnivalence" >¥</span>
            <span class="commodityUnivalence price">{$info['price']}</span>
            <span class="oldprice">¥{$info['price']}</span>
        </div>

        <div class="pad10">
            <div class="c-line"></div>
        </div>
        <div class="miaosha_time">
            <div class="right">
                <h1 class="timetitle">距离开抢时间：</h1>
                <div class="time-item">
                    <span id="day_show">0天</span>
                    <strong id="hour_show">00</strong><span class="dian">:</span>
                    <strong id="minute_show">00</strong><span class="dian">:</span>
                    <strong id="second_show">00</strong>
                </div>
            </div>
            <div class="clear"></div>
        </div>

        <div class="weui-panel">
            <div class="weui-panel__hd">商品参数</div>
            <div class="weui-panel__bd">
                <div class="weui-media-box weui-media-box_text">
                    <ul class="weui-media-box__info" style="padding-bottom: 0;margin-top:0;color:#504646;">
                        <li class="line20">包含卡券&nbsp;:<span class="pdl5"></span></li>

                    </ul>
                </div>
            </div>
        </div>
        <div class="bgfff">
            <h4 style="color:#999999;font-size: 13px;" class="pad10 border-bottom">商品详情</h4>
            <div class="info">
                {$info.goodsinfo}
            </div>
        </div>

        <div class="footer">
            <div class="btn">
                <input type="hidden" name="get_card_id" id="id" value="{$user.id}">
                <input type="hidden" name="fid" id="num" value="{$info.num}">
                <input type="hidden" name="fid" id="get_num" value="{$info.get_num}">
                <input type="hidden" name="fid" id="fid" value="{$info.id}">
                <input type="hidden" name="openid" id="openid" value="{$user.openid}">
                {eq name="$info['status']" value="1"}
                {eq name=":filterpaycard($info['starttime'],$info['endtime'])" value="0"}
                {eq name=":getpaysum($user['openid'],$info['id'])" value="0"}
                {eq name="$info['stocks']" value="0"}
                <button class="weui-btn weui-btn_default" id="weui-btn_default" style="background: #eee;">已售完</button>
                {else/}
                <button class="weui-btn weui-btn_primary " id="weui-btn_primary">支付{$info['price']}元</button>
                <button class="weui-btn weui-btn_default" id="weui-btn_default" style="display:none;background: #eee;">支付{$info['price']}元</button>
                {/eq}
                {else/}
                <a class="weui-btn weui-btn_default" id="weui-btn_default" href="{:url('cardusernu/mecard',['mid'=>$info['mid'] ])}" style="background: #eee;">您已经领取，请在微信卡包里查看</a>
                {/eq}
                {else/}
                <button class="weui-btn weui-btn_default" id="weui-btn_default" style="background: #eee;">不在活动时间</button>
                {/eq}
                {else/}
                <button class="weui-btn weui-btn_default" id="weui-btn_default" style="background: #eee;">该商品已下架</button>
                {/eq}
            </div>
        </div>

    </div>

</div>

<!----->
<div id="dialogt">
    <div class="js_dialog" id="iosDialog3" style="opacity: 1; display: none; z-index: 999;">
        <div class="weui-mask">
        </div>
        <div class="weui-dialog">
            <div class="weui-dialog__bd">
                <div class="bgfff chakan" >
                    <p class="ku"></p>
                </div>
            </div>
            <div class="weui-dialog__ft">

                <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary">确认</a>
            </div>
        </div>
    </div>
</div>

</body>
<script src="__STATIC_URL__/static/jquery/3.2.1/jquery.min.js"></script>
<script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script type="text/javascript">
    var intDiff = parseInt(60);//倒计时总秒数量
    function timer(intDiff){
        window.setInterval(function(){
            var day=0,
                hour=0,
                minute=0,
                second=0;//时间默认值
            if(intDiff > 0){
                day = Math.floor(intDiff / (60 * 60 * 24));
                hour = Math.floor(intDiff / (60 * 60)) - (day * 24);
                minute = Math.floor(intDiff / 60) - (day * 24 * 60) - (hour * 60);
                second = Math.floor(intDiff) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
            }
            if (minute <= 9) minute = '0' + minute;
            if (second <= 9) second = '0' + second;
            $('#day_show').html(day+"天");
            $('#hour_show').html('<s id="h"></s>'+hour);
            $('#minute_show').html('<s></s>'+minute);
            $('#second_show').html('<s></s>'+second);
            intDiff--;
        }, 1000);
    }
    $(function(){
        timer(intDiff);
    });
</script>
    <script type="text/javascript" id="tpl_dialog">
        $(function(){


            $('#dialogt').on('click', '.weui-dialog__btn', function(){
                $(this).parents('.js_dialog').fadeOut(200);
            });

        });
</script>
<script>
    $(function(){

        var get_num=parseInt($('#get_num').val());
        var num=parseInt($('#num').val());
        if(num == get_num){
            $("#weui-btn_primary").attr("style","display:none");
            $("#weui-btn_default").attr("style","display:block");

        }
    });
</script>
<script type="text/javascript">
    $(".weui-btn_primary").click(function () {
        var fid = $('#fid').val();
        var openid = $('#openid').val();
        var get_card_id=$('#id').val();
        var get_num=parseInt($('#get_num').val());
        var num=parseInt($('#num').val());


        if(num>get_num){

        $.ajax({
            url: "{:url('cardshoptest/addorder')}",
            type: 'post',
            dataType: 'json',
            data: {
                id: fid,
                openid: openid,
                get_card_id:get_card_id
            },

            success: function (data) {


                // return;
                if(data.code==0){
                    var url=data.data.url;
                    window.location.replace(url);
                    return;
                }
                if(data.code=='9003'){
                    alert(data.message);
                    return;
                }

            }
        })
        }else{
            $("#weui-btn_primary").attr("style","display:none");
            $("#weui-btn_default").attr("style","display:block");
            $(".ku").html("该商品没有库存！");
            $("#iosDialog3").fadeIn(200);
        }
    })



</script>
</html>
